package com.jacen.aws.setting;

import com.jacen.aws.entity.KeyEntity;
import com.jacen.aws.util.KeyUtil;

import java.io.File;
import java.util.HashMap;
import java.util.HashSet;

/**
 * 版权声明：Copyright(c) 2018 All Rights Reserved.
 *
 * @Author Jacen (295117485@qq.com)
 * @Date 2018/10/13 8:37
 * @Version 1.0
 * @Description 配置类
 */
public class Setting {

    public static final String SETTING_PATH = System.getProperty("user.home") + File.separator + ".aws";
    public static final String SETTING_IP_FILE_PATH = SETTING_PATH + File.separator + "ip.txt";
    public static final String SETTING_REGION_IP_FILE_PATH = SETTING_PATH + File.separator + "%s_ip.txt";
    public static final String SETTING_BLACK_IP_FILE_PATH = SETTING_PATH + File.separator + "black_ip.txt";
    public static final String LOG_FILE_PATH = SETTING_PATH + File.separator + "log-%s.log";

    public static final String TITLE_NAME = "换IP-Jacen(295117485@qq.com)";
    public static final String LABEL_INSTANCE_ID = "区域";
    public static final String LABEL_BLACK_IP = "黑名单";
    public static final String BTN_WHITE = "白";
    public static final String BTN_BLACK = "黑";
    public static final String BTN_COPY = "复制";
    public static final String BTN_READ = "读取";
    public static final String BTN_CHANGE = "切换";
    public static final String LIST_IP_NAME = "ipList";
    public static final String LIST_BLACK_IP_NAME = "blackIpList";

    public static final String IP_OWNER_ID = "amazon";

    public static final int ELASTIC_NO = 0;
    public static final int ELASTIC_YES = 1;

    public static final int USE_YES = 1;
    public static final int USE_NO = 0;

    public static final String REGION = "us-east-1";
    public static final int DOUBLE_CLICK = 2;
    public static HashMap<String, KeyEntity> keyMap = new HashMap<>();
    public static HashSet<String> ipSet = new HashSet<>();
    public static HashSet<String> blackIpSet = new HashSet<>();

    static {
        keyMap = KeyUtil.getKeyMap();

        //初始化配置路径
        File file = new File(Setting.SETTING_PATH);
        if (!file.exists()) {
            file.mkdir();
        }
    }

}
